"use strict"; (function($, elementor) { "use strict"; var Politono = { init: function init() { var widgets = { "politono-testimonial.default": Politono.Testimonial, "politono-sticky-post.default": Politono.StickyPost }; $.each(widgets, function(widget, callback) { elementor.hooks.addAction("frontend/element_ready/" + widget, callback); }); elementor.hooks.addAction( "frontend/element_ready/global", Politono.GlobalCallback ); }, Testimonial: function Testimonial($scope) { let target = $scope.find(".testimonial___slider"), scroll_direction = $(target).data("testimonial-direction"), testimonial_slider = new Swiper(target, { direction: scroll_direction, grabCursor: true, effect: "fade", fadeEffect: { crossFade: true }, lazy: { loadPrevNext: true }, autoplay: { delay: 2000 }, pagination: { el: $scope.find(".swiper-pagination"), clickable: true } }); target.on("mouseenter mouseleave", function(event) { if (event.type === "mouseenter") { testimonial_slider.autoplay.stop(); } if (event.type === "mouseleave") { testimonial_slider.autoplay.start(); } }); }, StickyPost: function($scope) { let target = $scope.find(".sticky_post_slider"), autoplay = target.data("autoplay"), loop = target.data("loop") ? target.data("loop") : false; let autoplay_data; if (autoplay === true) { autoplay_data = { delay: 5000, disableOnInteraction: false }; } let sticky_post_slider = new Swiper(target, { navigation: { nextEl: $scope.find(".sticky_post_next"), prevEl: $scope.find(".sticky_post_prev") }, loop: loop, autoplay: autoplay_data }); if (autoplay === true) { target.on("mouseenter mouseleave", function(event) { if (event.type === "mouseenter") { sticky_post_slider.autoplay.stop(); } if (event.type === "mouseleave") { sticky_post_slider.autoplay.start(); } }); } } }; $(window).on("elementor/frontend/init", Politono.init); })(jQuery, window.elementorFrontend);